package org.linlinjava.litemall.web.annotation.repeat;

import java.lang.annotation.*;
import java.util.concurrent.TimeUnit;

import static org.linlinjava.litemall.web.util.WebResponseCode.TOO_QUICK_OPERATION_RETRY;

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface RequestLock {

    /**
     * redis锁前缀
     * @return
     */
    String prefix() default "";

    /**
     * redis锁过期时间
     * @return
     */
    int expire() default 3;

    /**
     * redis锁过期时间单位
     * @return
     */
    TimeUnit timeUnit() default TimeUnit.SECONDS;


    /**
     * redis key分隔符
     * @return
     */
    String delimiter() default "&";

    /**
     * ⾃定义提示
     * @return
     */
    int message() default TOO_QUICK_OPERATION_RETRY;


}
